package com.neusoft.crm.controller;

import com.neusoft.crm.mapper.DataAreaMapper;
import com.neusoft.crm.po.DataArea;
import com.neusoft.crm.service.DataAreaService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class DataAreaController {

    @Resource
    private DataAreaService dataAreaService;
    @Resource
    private DataAreaMapper dataAreaMapper;

    @RequestMapping("/selectAllArea")
    public List<DataArea> selectAllArea(){
        return dataAreaMapper.selectList(null);
    }

    @RequestMapping("/deleteRegionInfoData")
    public int deleteRegionInfoData(@RequestBody DataArea dataArea){
        return dataAreaMapper.deleteById(dataArea);
    }

    @RequestMapping("/addRegionInfoData")
    public int addRegionInfoData(@RequestBody DataArea dataArea){
        return dataAreaMapper.insert(dataArea);
    }

    @RequestMapping("/updateRegionInfoData")
    public int updateRegionInfoData(@RequestBody DataArea dataArea){
        return dataAreaMapper.updateById(dataArea);
    }
}
